package com.cms.enums;

/**
 * @author chenxf
 * @date 4/10/2018
 * @description
 */
public enum VIPEnums {
    /**
     * 普通用户
     * 注册即可
     */
  V0(0, "会员", "REGIST", 0),
    /**
     * 会员
     * 购买即可
     */
    V1(1, "银星", "BUY",1),

    /**
     * 代理
     * 消费10 个
     */
    V2(2, "金星", "BUY",10),

    /**
     * 金牌
     * 消费100 个
     */
    V3(3, "玉星", "BUY",100),

    /**
     * 导师
     * 消费800 个
     */
    V4(4, "彩金", "BUY",500),

    /**
     * CEO
     * 消费1000 个
     */
    V5(5, "白金", "BUY",1000),

    /**
     * 董事
     * 消费1000 个
     */
    V6(6, "黑金", "BUY",3000);
    //ID
  private final int key;
    //名称
  private final String name;
    //操作
  private final String action;
    //团队购买数量要求
  private final int tjCount;
  private VIPEnums(int key, String name, String action,  int tjCount) {
    this.key = key;
    this.name = name;
    this.action = action;
    this.tjCount = tjCount;
  }

  public static VIPEnums checkVip(String action, int tjCount) {
    VIPEnums[] its = values();
    VIPEnums[] arr$ = its;
    int len$ = its.length;
    for (int i$ = len$-1; i$ >=0; --i$) {
      VIPEnums it = arr$[i$];
      if("REGIST".equals(action)){
          return it;
      }
      if (tjCount>=it.getTjCount()) {
          return it;
      }
    }
    return V0;
  }


  public static VIPEnums getIdType(int idType) {
    VIPEnums[] its = values();
    VIPEnums[] arr$ = its;
    int len$ = its.length;

    for (int i$ = 0; i$ < len$; ++i$) {
      VIPEnums it = arr$[i$];
      if (it.getKey()==idType) {
        return it;
      }
    }
    return V0;
  }

    public int getKey() {
        return key;
    }

    public String getName() {
        return name;
    }

    public String getAction() {
        return action;
    }

    public int getTjCount() {
        return tjCount;
    }}
